1. Field of the Invention
This invention relates generally to the field of computer systems and, more particularly, to performing a synchronization operation for multiple devices in a computer system.
2. Description of the Related Art
A central resource in a computer system may be configured to perform multiple processing operations simultaneously. The central resource may perform these multiple processing operations by including multiple processing elements, or agents. In some cases, the agents may be synchronized where all agents begin processing at the same time, spend the same amount of time processing, and thus finish processing their tasks at the same time. In other cases, the agents may be unsynchronized where individual agents may begin tasks at different times and may take different amounts of time to perform those tasks.
A central resource that includes multiple agents may receive a varying inflow of work from a variety of devices. As the agents in the central resource finish tasks, they may begin new tasks if new tasks are available or wait for new tasks if no tasks are pending. Agents that are currently performing or processing a task may be termed xe2x80x9cbusyxe2x80x9d while agents that are not performing or processing a task may be termed xe2x80x9cidle.xe2x80x9d The act of an agent finishing a task, whether or not another task is waiting to be processed, may be termed xe2x80x9ccycling.xe2x80x9d Accordingly, an agent that has finished its task may be said to have cycled. In order to more efficiently utilize the central resource, the devices that use it need to be able to detect when tasks that have been submitted to the central resource have completed by the agents.
A device may detect the completion of a task or a set of tasks by a central resource by initiating a synchronization operation, referred hereafter as a sync operation. A sync operation may be described as the process of determining when all tasks being performed at a given time have completed. A device that initiates a sync operation may be called an xe2x80x9cobserver.xe2x80x9d
Several possible implementations of a sync operation exist. In one implementation, a system may simply stop processing new tasks until all outstanding tasks have been completed to complete a sync operation. In this case, the sync operation may undesirably delay the processing of new tasks. In another implementation, a system could require that agents signal completion of a task to the device that requested the task by sending a message or an interrupt. This implementation, however, may result in increased traffic on a system bus such that fewer devices may be connected to the bus and included in the system. In a further implementation, each agent could include a state bit that was visible to an observer and that was indicative of whether the agent was busy or not. To perform a sync operation in this implementation, an observer could monitor the state bits for each agent and determine that all tasks have been completed when the state bits indicate that all agents are idle. If the agents receive a steady supply of tasks, however, there is no assurance that all agents would ever be idle and the sync operation may not be able to complete. Yet a further sync operation implementation may involve including a dedicated synchronization resource in the central resource. Such an implementation may not allow multiple observers to be running sync operations concurrently and may not be fully scalable as additional observers may require additional resources to be added to the synchronization resource.
A system and method is needed to efficiently perform a sync operation for multiple devices in a computer system. In addition, a system and method is needed to allow for multiple concurrent sync operations and for scalability in a system that performs a sync operation for multiple devices.
The problems outlined above are in large part solved by the use the system and method described herein. Generally speaking, a system and method for performing a sync operation for multiple devices in a computer system is provided. The computer system may include a plurality of devices and a plurality of agents. The agents may be configured to perform tasks on behalf of the devices. A busy bit and a counter may be included for each of the agents. One of the devices may become an observer by initiating a sync operation. In response to a sync operation, busy agents may be identified using the busy bit for each agent. The busy agents may then be monitored to determine when each one has cycled using the busy bit and the counter for each busy agent. A busy agent may be determined to have cycled in response to its busy bit indicating that it is no longer busy or in response to its counter value differing from the counter value at the time the sync operation was initiated. Once all of the busy agents have cycled, the observer may determine that the sync operation is complete.
In one particular embodiment, the counter for each agent may comprise a one bit counter. The one bit counters for each agent may be stored in a counter register and the busy bits for each agent may be stored in a busy register. In response to a sync operation, the values in these registers may be monitored to determine when all busy agents have cycled. Once all of the busy agents have cycled, the observer may determine that the sync operation is complete.
Certain embodiments described herein may allow for advantages over other systems and methods that are configured to implement a sync operation. For example, certain embodiments may allow for a relatively inexpensive hardware or software implementation using a busy bit and a counter for each agent in the system. In addition, certain embodiments may be fully scalable for any number of observers and different observers may perform sync operations concurrently without the need for additional hardware.